package com.soft.mainsite.common.constant;

import java.io.File;

/**
 * Description:内容管理系统字典
 *
 * @author Jin
 * @create 2017-06-01
 */
public class CmsConst {

    public static final String SITE_NOT_FOUND = "站点不存在或已经被删除，请与系统管理员联系！";

    public static final String SITE_LOCKED = "当前站点已经停用，请与系统管理员联系！";

    public static final String PAGE_NOT_FOUND = "页面被删除或者不存在！";

    public static final String CATEGORY_NOT_FOUND = "栏目已经被删除或者不存在！";

    public static final String CONTENT_NOT_FOUND = "内容已经被删除或者不存在！";

    public static final String TOPIC_NOT_FOUND = "专题已经被删除或者不存在！";

    public static final String SEARCH_KEYWORD_NOT_FOUND = "搜索关键字不能为空！";

    public static final String SITE_USER_SESSION_KEY = "SysUser";
    public static final String USER_ROLE_NOT_NULL = "用户角色不能为空！";
    public static final String CHOOSE_USER_ROLE = "请选择用户角色！";

    public static final String XML_HTTP_REQUEST = "XMLHttpRequest";

    public static final String X_REQUESTED_WITH = "X-Requested-With";

    /**
     * 主站推送条数
     */
    public static final String PARAM_PUBSIZE = "pubSize";

    /**
     * 标点符号，逗号
     */
    public static final String PUNCTUATION_COMMA = ",";

    /**
     * 标点符号，点号
     */
    public static final String PUNCTUATION_POINT = ".";

    /**
     * png格式的图片
     */
    public static final String IMAGE_PNG = "png";

    /**
     * gif格式的图片
     */
    public static final String IMAGE_GIF = "gif";

    /**
     * jpg格式的图片
     */
    public static final String IMAGE_JPG = "jpg";


    /**
     * ES中content  index名
     */
    public static final String INDEX_NAME = "mainsite";

    /**
     * ES中热装楼盘  index名
     */
    public static final String HOT_ESTATE_INDEX = "hot_estate";
    /**
     * ES中热装楼盘  type名
     */
    public static final String HOT_ESTATE_TYPE= "hot_estate";

    /**
     * ES中多字段查询
     */
    public static final String SEARCH_FIELDS = "title,keywords,description";

    /**
     * 只有主站可以看到的栏目id
     */
    public static final String EX_CATEGORY = "2,4,8,10,13,15,19,24,25,26,27,28,29,30,31,32,33,34,35,38,42,44,45";

    /**
     * ES查询站点类型为1的组合
     */
    public static final String[] SITETYPE_1 = {"1", "1,2", "1,3", "1,2,3"};

    /**
     * ES查询站点类型为2的组合
     */
    public static final String[] SITETYPE_2 = {"2", "2,3", "1,2", "1,2,3"};

    /**
     * ES查询站点类型为3的组合
     */
    public static final String[] SITETYPE_3 = {"3", "1,3", "2,3", "1,2,3"};

    /**
     * 智慧子系统表名
     */
    public static final Long INTELLIGENT_SUBSYSTEM_MODEL_ID = 44L;

    /**
     * 产品清单
     */
    public static final Long HOME_SETTINGS_MODEL_ID = 42L;

    /**
     * 站点类型数据字典id
     */
    public static final Integer SITE_TYPE_ID = 1;

    /**
     * 初始化失败站点状态
     */
    public static final Integer SITE_STATIC_ERROR = 2;

    public static final Integer SITE_STATIC_SUCCESS = 1;

    /**
     * 公共栏目模板片段
     */
    public static final Integer COMMON_STATIC = 1;

    /**
     * 单页模板
     */
    public static final Integer SINGLE_STATIC = 0;

    /**
     * 新增静态化
     */
    public static final Integer ADD_STATIC = 0;

    /**
     * 删除静态化
     */
    public static final Integer DEL_STATIC = 1;

    /**
     * 推荐
     */
    public static final Integer RECOMMEND = 1;

    /**
     * 公共栏目
     */
    public static final Integer IS_PUB = 1;

    /**
     * 主站点id
     */
    public static final Integer MAIN_SITE_ID = 1;

    /**
     * 主站站点类型
     */
    public static final String MAIN_SITE_TYPE = "4";

    /**
     * 公共模版路径
     */
    public static final String MOBILE_PATH = "mobile";

    /**
     * 移动端根目录
     */
    public static final String COMMON_HTML = "commonHtml";

    /**
     * pc端根目录
     */
    public static final String WEB_PATH = "web";

    /**
     * 移动端模板类型
     */
    public static final String TPL_TYPE_MOBILE = "mobile";

    /**
     * pc端模板类型
     */
    public static final String TPL_TYPE_PC = "pc";

    /**
     * 移动端静态化
     */
    public static final Integer STATIC_TYPE_MOBILE = 1;

    /**
     * PC端静态化
     */
    public static final Integer STATIC_TYPE_PC = 2;


    public static final String TEMPLATE_PATH = "theme/";
    /**
     * 按距离最近排序
     */
    public static final String DISTANCE = "1";
    /**
     * 按人气排序
     */
    public static final String POPULARITY = "2";

    public static String SUFFIX_INDEX = "index";

    public static final String INDEX_TPL = "index";

    public static String FORWARD = "forword";

    public static final String CATEGORY_INDEX_TPL = "category";

    public static final String CATEGORY_LIST_TPL = "category_list";

    public static final String CONTENT_TPL = "content";

    public static final String SEARCH_TPL = "search";

    public static final String TOPIC_TPL = "topic";

    /**
     * 46 热装楼盘栏目ID
     */
    public static final int HOT_ESTATE_CATEGORY = 46;

    /**
     * 热点资讯栏目ID
     */
    public static final int HOTSPOT_INFORMATION_CATEGORY = 25;

    /**
     * 展会风采栏目ID
     */
    public static final int EXHIBITION_STYLE_CATEGORY = 42;

    /**
     * 首页智慧资讯栏目ID
     */
    public static final int WISDOM_INFORMATION_CATEGORY = 3;

    /**
     * 6 代表CRM系统里的客户来源中的网站引流
     */
    public static final String SITE = "6";

    /**
     * 3 代表CRM系统里的终端客户
     */
    public static final String CONSUMER = "3";

    /**
     * 字符串模板类型转数字模板类型
     * @param tplType
     * @return
     */
    public static Integer getStaticTypeByTplType(String tplType){
        if(TPL_TYPE_PC.equals(tplType)||STATIC_TYPE_PC.toString().equals(tplType)){
            return STATIC_TYPE_PC;
        }
        return STATIC_TYPE_MOBILE;
    }

    /**
     * 数字模板类型转字符串模板类型
     * @param deviceType
     * @return
     */
    public static String getTplTypeByDeviceType(Integer deviceType){
        if(STATIC_TYPE_PC.equals(deviceType)){
            return WEB_PATH;
        }
        return MOBILE_PATH;
    }

    /**
     * 根据设备访问类型（移动或者PC）获取模板类型路径
     * @param deviceType
     * @return
     */
    public static String getTplTypePathByDeviceType(Integer deviceType){
        if(STATIC_TYPE_PC.equals(deviceType)){
            return "";
        }
        return File.separator + MOBILE_PATH;

    }
}
